package net.ojbk.study.curriculumDesign.service.impl.usermanage;


import net.ojbk.study.curriculumDesign.beans.usermanage.User;
import net.ojbk.study.curriculumDesign.dao.usermanage.UserDao;
import net.ojbk.study.curriculumDesign.service.usermanage.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements IUserService {

   @Autowired
   @Qualifier("userDao")

   /**
    * 声明变量
    *
    */
    private UserDao userDao;

    @Override
    public void addOneUser(User user) {
        /**
         * 控制层传数据到user再传递给Dao层
         *
         */
        /**
         * 新增一个用户信息
         *
         */
        userDao.insertOne(user);
    }
@Override
    public void deleteOneUser(User user) {
    /**
     *  删除一个用户信息
     *
     */
        userDao.deleteOne(user);
    }
@Override
    public void updateOneUser(User user) {
    /**
     * 修改一个用户信息(修改原有属性且保存到数据库中)
     *
     */
        userDao.updateOne(user);
    }

    @Override
    public List<User> getAllUser() {
        /**
         * 查找全部用户信息
         *
         */
        return userDao.selectAll();
    }

    @Override
    public User getOneUser(User user) {
        return userDao.getUser(user);
    }
}


